package com.bean.library;

public class Option {
	protected boolean isMulti;//是否是多选题目的选项
	protected int fatherSubjectId;//所属题目的id
	protected int optId;//选项的id
	protected String optContent;//选项的名字
	
	
	protected String optName;//不理
	protected String optValue;
	public final static  String LINKCHAR = "_";
	public Option(){
		
	}
	public boolean isMulti() {
		return isMulti;
	}
	public void setMulti(boolean isMulti) {
		this.isMulti = isMulti;
	}
	public int getOptId() {
		return optId;
	}
	public void setOptId(int optId) {
		this.optId = optId;
	}
	public String getOptContent() {
		return optContent;
	}
	public void setOptContent(String optContent) {
		this.optContent = optContent;
	}
	public String getOptName() {
		if(isMulti)optName = fatherSubjectId + LINKCHAR + optId;
		else optName = String.valueOf(fatherSubjectId);
		return optName;
	}
	public String getOptValue() {
		if(isMulti)optValue = null;
		else optValue = String.valueOf(optId);
		return optValue;
	}
	public static String getSubjectId(String subjectIdAndOptId){
		int temp = subjectIdAndOptId.indexOf(LINKCHAR);
		return subjectIdAndOptId.substring(0,temp - 1);
	}
	public static String getOptId(String subjectIdAndOptId){
		int temp = subjectIdAndOptId.indexOf(LINKCHAR);
		return subjectIdAndOptId.substring(temp + 1);
	}
}
